<template>
  <view class="nav-bar">
<!--   <view class="left">
      <u-icon name="arrow-left" size="24" @click="goBack" />
    </view> -->
    <view class="title">{{ title }}</view>
    <view class="right">
      <u-icon name="search" size="24" @click="onSearchClick" />
    </view>
  </view>
</template>

<script setup lang="ts">
import { defineProps, defineEmits } from 'vue';

const props = defineProps({
  title: {
    type: String,
    default: '标题'
  }
});

const emit = defineEmits(['search']);

// const goBack = () => {
//   uni.navigateBack();
// };

const onSearchClick = () => {
  emit('search');
  console.log('搜索图标被点击了');
  uni.navigateTo({
  	url: '/pages/searchPage/index'
  });
};
</script>

<style scoped>
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100rpx; 
  padding: 0 10px;
  background-color: #FFFFFF;
  border-bottom: 1px solid #E8E8E8;
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}
/* .left, .right {
  width: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
} */
.right {
  width: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.title {
  flex: 1;
  text-align: center;
  font-size: 30rpx;
  /* font-weight: bold; */
}
</style>
